package com.tengju.user.domain.model.archive.sign;

import com.fasterxml.jackson.annotation.JsonValue;

public enum SelfCertificationType {

    ENTERPRISE(1, "企业"),
    PERSONAL(2, "个体工商户"),
    ;

    private int val;
    private String desc;

    SelfCertificationType(int val, String desc) {
        this.val = val;
        this.desc = desc;
    }

    @JsonValue
    public int getVal() {
        return val;
    }

    public String getDesc() {
        return desc;
    }

    public static SelfCertificationType fromVal(Integer val) {
        for (SelfCertificationType type : values()) {
            if (type.val == val) {
                return type;
            }
        }
        return null;
    }


    public static SelfCertificationType fromName(String name) {
        for (SelfCertificationType type : values()) {
            if (type.name().equals(name)) {
                return type;
            }
        }
        return null;
    }

}
